package com.hu.lsp.Test;

/**
 * @Author lsp
 * @Date 2020/5/21 14:13
 * @Version 1.0
 */
public class SingleThreadMain {
    public static void main(String[] args) {
       /* //实现runnable 方式
        Thread  s = new Thread(new SingleThread());
        //集成thread类直接new对象
        // SingleThread s = new SingleThread();
         s.start();

        for (int i = 0; i < 1000; i++) {
            System.out.println(i + "SingleThreadMain");
        }*/

        /*for (int i = 0; i < 10; i++) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(i + "SingleThreadMain");
        }*/


    }

    Thread  s = new Thread(new SingleThread());
    public  void deposit(int i){
        synchronized(this){
            System.out.println("锁的当前对象deposit"+i);
        }
        synchronized (SingleThreadMain.class){
            System.out.println("锁的当前类SingleThreadMaint"+i);
        }

    }



}
